<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

/**
 * 岗位和权限中间表
 *
 * Date: 05/05/2018
 * @author George
 */
class PositionPermissionPivotTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('position_permission_pivot', function (Blueprint $table) {
            $table->unsignedInteger('position_id')->index();
            $table->string('permission_code')->index();
            $table->primary(['position_id', 'permission_code']);
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('position_permission_pivot');
    }
}
